package cn.meeh.sscircle.module.account;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.FocusChange;
import org.androidannotations.annotations.ViewById;

import cn.meeh.sscircle.R;
@EActivity(R.layout.activity_login)
public class LoginActivity extends Activity {

    @ViewById(R.id.login_password_et)
    EditText passwordET;
    @ViewById(R.id.login_phonenum_et)
    EditText phoneNumET;
    @ViewById(R.id.login_reg_btn)
    TextView regBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @FocusChange(R.id.login_password_et)
    void onFocusChangesOnPassword(View v, boolean hasFocus)
    {
        EditText et = (EditText)v;
        if(hasFocus)
        {   ///把输入框设置为不显示密码
            et.setTransformationMethod(PasswordTransformationMethod.getInstance());
            et.setText("");
        }
    }

    @FocusChange(R.id.login_phonenum_et)
    void onFocusChangesOnPhoneNum(View v,boolean hasFocus)
    {
        EditText et = (EditText)v;
        if(hasFocus&&et.getText().toString().equals("请输入手机号码"))
            et.setText("");//第一次输入时清空输入框
    }

    @Click(R.id.login_reg_btn)
    void onClickOnRegBtn()
    {
        Intent intent = new Intent();
        intent.setClass(this,VerifyPhoneActivity_.class);
        startActivity(intent);
    }
}
